{{if $.error}}
<div class="ui error message">
    <ul class="list">
        <li>{{$.errTitle}}</li>
    </ul>
</div>
{{end}}
<form class="ui form" id="form_menu">
    <div class="  field " style="display:none">
        <label>Id</label>
        <input type="text" name="Id" value="{{$.menutable.Id}}">
    </div>
    <div class="  field ">
        <label>编码</label>
        <input type="text" name="Code" value="{{$.menutable.Code}}"> {{if $.errmap}} {{$errCode := index $.errmap "errCode"}} {{if $errCode}}
        <div class="ui pointing red basic label">{{$errCode}} </div>
        {{end}} {{end}}
    </div>
    <div class=" field ">
        <label>名字</label>
        <input type="text" name="Text" value="{{$.menutable.Text}}"> {{if $.errmap}} {{$errText := index $.errmap "errText"}} {{if $errText}}
        <div class="ui pointing red basic label">{{$errText}} </div>
        {{end}} {{end}}
    </div>
    {{$grade := .menutable.Grade}}
    <div class="  field ">
        <label>级数</label>
        <select onchange="changeselect()" name="Grade">
            <option value="1" {{if $grade}}{{if eq $grade 1 }}selected{{end}}{{end}}>1</option>
            <option value="2" {{if $grade}}{{if eq $grade 2 }}selected{{end}}{{end}}>2</option>
            <option value="3" {{if $grade}}{{if eq $grade 3 }}selected{{end}}{{end}}>3</option>
        </select>
    </div>
    {{$pid := $.menutable.Pid}}
    <div class=" field " id="parentmenu" style="display:{{if $pid}}{{if gt $pid 1}}block{{else}}none{{end}}{{else}}none{{end}}">
        <label>父菜单</label>
        <select name="Pid" value="{{$pid}}">
            {{range $m,$n := $.allmenu}}
            <option value="{{$n.id}}" {{if $pid}}{{if compare $n.id $pid}}selected{{end}}{{end}}>{{$n.text}}</option>
            {{end}}
        </select>
    </div>
    <div class=" field " id="url" {{if compare 3 $.menutable.Grade}} {{else}}style="display:none;" {{end}}>
        <label>URL</label>
        <input type="text" name="Url" value="{{$.menutable.Url}}"> {{if $.errmap}} {{$errUrl := index $.errmap "errUrl"}} {{if $errUrl}}
        <div class="ui pointing red basic label">{{$errUrl}} </div>
        {{end}} {{end}}
    </div>
    <div class=" field ">
        <label>重要系数</label>
        <input type="text" name="Mount" value="{{$.menutable.Mount}}">
        {{if $.errmap}} {{$errUrl := index $.errmap "errUrl"}} {{if $errUrl}}
        <div class="ui pointing red basic label">{{$errUrl}} </div>
        {{end}} {{end}}
    </div>
    <div class=" field">
        <label>备注</label>
        <textarea name="Description" rows="2">{{$.menutable.Description}}</textarea>
    </div>
    <div class="ui checkbox">
        <input type="checkbox" name="Status" {{if $.menutable.Id}} {{if eq $.menutable.Status "on"}} checked="checked" {{end}} {{else}} checked="checked" {{end}}>
        <label>启用</label>
    </div>
</form>
<div class="row">
    <p>&nbsp</p>
</div>
<div class="ui buttons">
    <button class="ui button active" onclick="cancle()">Cancel</button>
    <div class="or"></div>
    <button class="ui positive button" onclick="saveform('/menu/menus/menusave','form_menu')">Save</button>
</div>
